<?php


    // Author: Tomasz Durka
    // Date: 4th April 2007
    // Prints out a HTML submit tag
    
    
  function checkbox ($name, array $params = array()) {
    $flat_name = $name;
    $flat_name = str_replace('[', '_', $flat_name);
    $flat_name = str_replace(']', '', $flat_name);
    $flat_name = strtolower($flat_name);
    $id = " id=\"{$flat_name}\"";
    $class = isset($params['class']) ? " class=\"{$flat_name} {$params['class']}\"" : " class=\"{$flat_name}\"";
    $style = " style=\"{$params['style']}\"";
    $on_change = " onChange=\"{$params['on_change']}\"";
    $on_click = " onClick=\"{$params['on_click']}\"";
    $value = isset($params['value']) ? $params['value'] : "1";
    $disabled = $params['disabled'] == true ? ' disabled="disabled"' : '';
    
    # Type assign
    $type = 'checkbox';
    
    
    $returned = "<input type=\"{$type}\" name=\"{$name}\" value=\"{$value}\"{$class}{$style}{$id}{$size}{$on_change}{$on_click}{$disabled} />";
    //$returned = htmlspecialchars($returned);
    return $returned;
  }

?>